package com.wc.alorithm_luogu.P5716;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/18 10:46
 * @description https://www.luogu.com.cn/problem/P5716
 * 月份天数
 */
public class Main {
    static int[] dayOfMonth = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int year = sc.nextInt();

        int month = sc.nextInt();

        int dayOf2 = 29;

        // 判断闰年
        if (year % 4 == 0) {
            if (year % 100 == 0) {
                dayOf2 = 28;
            }
            if (year % 400 == 0) {
                dayOf2 = 29;
            }
        } else {
            dayOf2 = 28;
        }
        dayOfMonth[2] = dayOf2;

        System.out.println(dayOfMonth[month]);
    }
}
